package com.qf.entity;

import java.util.List;

/**
 * @author a1275872671
 * @version v1.0
 * @project guanqipeng
 * @package com.qf.entity
 * @company
 * @date 2024/4/30 11:27
 */
public class Pagebean<T> {
    //页码
    private  int  pageNum;
    //页大小
    private int pageSize;
    //总数据个数
    private long totalCount;
    //总页书
    private int pageCount;
    //每页数据
    private List<T> data;

    public Pagebean() {
    }

    public Pagebean(int pageNum, int pageSize, long totalCount, List<T> data) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.data = data;
        this.pageCount=(int)Math.ceil((double)totalCount/pageSize);
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public long getPageCount() {
        return pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "Pagebean{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", totalCount=" + totalCount +
                ", pageCount=" + pageCount +
                ", data=" + data +
                '}';
    }
}
